//截图
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

import java.io.File;
import java.io.IOException;

public class Test06 {
    public static void main(String[] args) throws IOException {
        WebDriver webDriver=new ChromeDriver();
        webDriver.get("https://www.baidu.com/");
        File file=((TakesScreenshot)webDriver).getScreenshotAs(OutputType.FILE);
        //把file把存到本地
        FileUtils.copyFile(file,new File("D://截图.png"));

    }
}
